{% extends './layout.html'%} {%block main%}
<style>
	h6 {
		margin-bottom: 5px;
	}
	i.qrcode{
		cursor: pointer;
	}
	#qrcode{
		text-align: center;
		padding : 20px 40px;
		display: none;
	}
	#qrcode p{
		padding-top:30px;
	}
</style>
<blockquote class="layui-elem-quote news_search layui-form">
	<form action="">
	<div class="layui-inline">
		<div class="layui-input-inline">
			<h6>角色选择</h6>

            <select name="type" lay-verify="">
				<option value="">不限</option>
				<option value="normal" {{'selected' if type == 'normal'}}>综合会员</option>
                <option value="jingji" {{'selected' if type == 'jingji'}}>经纪会员</option>
			</select>  
		</div>

	</div>
    <div class="layui-inline">
		<div class="layui-input-inline">
			<h6>公司名称</h6>
			<input type="text" name=nickname value="{{nickname}}" placeholder="公司名称" class="layui-input search_input">
		</div>

	</div>

	
	<div class="layui-inline" style=''>
		<h6>&nbsp;</h6>
		<a class="layui-btn layui-btn-normal" onclick='$("form").submit()'>查询</a>
		<!--<a class="layui-btn addJingji">添加</a>-->
	</div>
	</form>
	<!--<div class="layui-input-inline">
			<input type="text" value="" placeholder="开始时间" class="layui-input search_input">
		</div>
		<div class="layui-input-inline">
			<input type="text" value="" placeholder="结束时间" class="layui-input search_input">
		</div>
		<div class="layui-input-inline">
			<input type="text" value="" placeholder="所属单位" class="layui-input search_input">
		</div>
		<a class="layui-btn search_btn">查询</a>-->
</blockquote>

<div class="layui-form news_list">
	<table class="layui-table">

		<thead>
			<tr>
				<th style="text-align:left;">
					序号</th>
				<th>公司名称</th>
				<th>冻结备付金</th>
				<th>备付金阈值</th>
				<th>当前余额</th>
                <th>可用备付金</th>
				<th>安全值</th>

			</tr>
		</thead>

		<tbody class="news_content">
			{%for item in list%}
			<tr>
				<td>{{loop.index}}</td>
                <td>{{item.nickname}}</td>
				<td>{{item.dj_money | money}}</td>
				<td>
					{{item.limit_money | money}}
				</td>
				<td>
					{{item.money | money}}
				</td>
				<td>
					{{item.money | money}}
				</td>
				<td>
					100%
				</td>


			</tr>
			{%endfor%}
		</tbody>
	</table>
</div>

<div id='qrcode'>
	<div src="" alt="" ></div>
	<p>
		12312312312312
	</p>
</div>

{%endblock%} {%block js%}
<script src='/static/js/qrcode.js'></script>
<script>
	layui.use(["laydate", "element", "form"], function(laydate, ele, form) {
		//执行一个laydate实例
		laydate.render({
			elem: '#start_time' //指定元素
		});

		laydate.render({
			elem: '#end_time' //指定元素
		});

		form.on("select(action)", function(data) {
			var val = data.value;
			if(val == '') {
				return;
			}
			var id = $(data.elem).attr('data-id');
			switch(val) {
				case 'edit':
					openWindow("编辑", "/proxy/addMember.html?id=" + id)
					break;
					
				case 'login_pass':
					layer.prompt({title: '输入新密码', formType: 1}, function(pass, index){
					  	var index = layer.load();
			  			layer.closeAll();
					  	
					  	$.post("/proxy/api/modify_password",{
					  		id : id,
					  		pass : pass,
					  		"type" : "login"
					  	},function(msg){
					  		if(msg.success){
								layer.msg("修改成功",{icon : 1})
					  		}
					  		else{
					  			layer.msg("修改失败",{icon : 2})
					  		}
					  	},'json');
					});
					break;
					
				case 'pay_pass':
					layer.prompt({title: '输入新密码', formType: 1}, function(pass, index){
					  	var index = layer.load();
			  			layer.closeAll();
					  	
					  	$.post("/proxy/api/modify_password",{
					  		id : id,
					  		pass : pass,
					  		type : "pay"
					  	},function(msg){
					  		if(msg.success){
								layer.msg("修改成功",{icon : 1})
					  		}
					  		else{
					  			layer.msg("修改失败",{icon : 2})
					  		}
					  	},'json');
					});
					break;
					
				case 'zhuanyi':
					break;
			}
			$(data.othis).parent().find("[lay-value='']").trigger('click');
			//			alert(1)
		});
	});

	function openWindow(title, href) {
		var index = layui.layer.open({
			title: title,
			type: 2,
			content: href,
			success: function(layero, index) {
				setTimeout(function() {
					//layui.layer.tips('点击此处返回', '.layui-layer-setwin .layui-layer-close', {
					//	tips: 3
					//});

					var iframe = $('iframe');
					var body = $(iframe.contents()).find("body");
					iframe.height($(window).height() - 100)
				}, 100);
			}
		})

		layui.layer.full(index);
	}

	$(function() {

		
		$('.qrcode').click(function(){
			var id = $(this).attr('data-id');

			var url = "http://www.baidu.com/s" + id
			$('#qrcode > div').html("").qrcode({
				width: 200,
				height:200,
				text: url
			});
			
			$('#qrcode > p').html(url);

			layui.layer.open({
				type : 1,
				content : $('#qrcode'),
				title : "推广二维码"
			});
		});

		$(window).one("resize", function() {
			$('.addJingji').click(function() {
				openWindow("添加", "/proxy/addMember.html?");
			});
		}).resize();
	})
</script>
{%endblock%}